﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Xml.Linq;

namespace Update {
    /// <summary>
    /// 更新服务器接口
    /// </summary>
    public interface IUpdateServer {
        /// <summary>
        /// 初始化服务器
        /// </summary>
        /// <param name="config">配置信息</param>
        void Initialize(XElement config);

        /// <summary>
        /// 获取服务器版本
        /// </summary>
        /// <returns>服务器版本号</returns>
        string GetServerVersion();

        /// <summary>
        /// 下载更新包
        /// </summary>
        /// <param name="version">版本号</param>
        /// <param name="savePath">保存路径</param>
        /// <param name="progressCallback">进度回调</param>
        /// <returns>下载的文件路径</returns>
        string DownloadUpdatePackage(string version, string savePath, Action<int, double, string> progressCallback);

        /// <summary>
        /// 获取更新日志
        /// </summary>
        /// <param name="version">版本号</param>
        /// <returns>更新日志内容</returns>
        string GetChangelog(string version);

        /// <summary>
        /// 是否支持更新日志功能
        /// </summary>
        bool SupportsChangelog { get; }
    }
}